home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / fgl110c.zip / 09-12.C < prev    next >
Text File  |  1992-01-31  |  1KB  |  48 lines

  1. #include <fastgraf.h>
  2. #include <io.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6. void main(void);
  7.  
  8. char pixel_runs[20000];
  9.  
  10. void main()
  11. {
  12.    long filelength();
  13.    FILE *stream;
  14.    int file_size, run_count;
  15.    int old_mode, new_mode;
  16.  
  17.    new_mode = fg_bestmode(320,200,1);
  18.    if (new_mode < 0 || new_mode == 12) {
  19.       printf("This program requires a 320 ");
  20.       printf("x 200 color graphics mode.\n");
  21.       exit(1);
  22.       }
  23.  
  24.    old_mode = fg_getmode();
  25.    fg_setmode(new_mode);
  26.  
  27.    stream = fopen("coral.spr","rb");
  28.    file_size = (int)(filelength(fileno(stream)));
  29.    fread(pixel_runs,sizeof(char),file_size,stream);
  30.    fclose(stream);
  31.    run_count = file_size / 2;
  32.    fg_move(0,199);
  33.    fg_display(pixel_runs,run_count,320);
  34.    fg_waitkey();
  35.  
  36.    stream = fopen("coral.ppr","rb");
  37.    file_size = (int)(filelength(fileno(stream)));
  38.    fread(pixel_runs,sizeof(char),file_size,stream);
  39.    fclose(stream);
  40.    run_count = file_size / 3 * 2;
  41.    fg_erase();
  42.    fg_displayp(pixel_runs,run_count,320);
  43.    fg_waitkey();
  44.  
  45.    fg_setmode(old_mode);
  46.    fg_reset();
  47. }
  48.